package com.mapper;
import com.pojo.CePing;
import com.pojo.User;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;
import java.util.List;

@Mapper
public interface CePingMapper {
    @Select("SELECT ce.*,uc.c_id,uc.u_id FROM ceping_chen ce JOIN user_ce uc on ce.id=uc.c_id join user_chen u on u.id=uc.u_id where u.id=#{id}")
    @Results({
            @Result(property = "id", column="id"),
            @Result(property = "title",column = "title"),
            @Result(property = "img",column = "img"),
            @Result(property = "userList",column = "ce.id",many = @Many(select = "com.hualan.mapper.CePingMapper.selectUser",fetchType = FetchType.LAZY))
    })
    List<CePing> selectAll(CePing cePing);
    @Select("select u.id from user_chen u join user_ce uc on uc.u_id=u.id where uc.u_id=#{id};")
    List<User> selectUser(Integer id);
}
